package com.spring.main.aop;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

/**
 * @auther zhangwj
 * @date 2020/4/29 5:32 下午
 */
public class ProxyHandler {

    public void test() {
        System.out.printf("我是测试");
    }

    public void demo(Class clazz, Method method) throws IllegalAccessException, InstantiationException, InvocationTargetException {
        method.invoke(clazz.newInstance());
    }

    public static void main(String[] args) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException {
        ProxyHandler proxyHandler = new ProxyHandler();
        proxyHandler.demo(ProxyHandler.class,ProxyHandler.class.getMethod("test"));

    }
}
